package sc.test.spring.threads;

import org.apache.commons.lang3.StringUtils;

/**
 * 对账优先级
 */
public enum Priority {

    High("H", "高"),
    Middle("M", "中"),
    Low("L", "低");

    Priority(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public static Priority getByCode(String code) {
        if (StringUtils.isBlank(code)) {
            return null;
        }

        for (Priority type : Priority.values()) {
            if (type.getCode().equals(code)) {
                return type;
            }
        }

        return null;
    }

    private final String code;

    private final String message;

    public String getCode() {
        return code;
    }

    public String getMessage() {
        return message;
    }

}
